import Vue from 'vue'
import VueRouter from 'vue-router'


import Login from 'components/Login.vue'
import Home from 'components/Home.vue'
import GameOneLife from 'components/GameOneLife.vue'
import Ninja from 'components/Ninja.vue'
import Main from 'components/Main.vue'
import Calendar from 'components/Calendar.vue'
import Message from 'components/Message.vue'
Vue.use(VueRouter)


const router = new VueRouter({
    routes: [

        { path: '/', redirect: '/login' },
        { path: '/login', component: Login },
        {
            path: '/home',
            component: Home,
            children: [
                { path: '/home', component: Main },
                { path: '/home/1-1', component: GameOneLife },
                { path: '/home/1-2', component: Ninja },
                { path: '/home/1-3', component: Calendar },
                { path: '/home/1-4', component: Message }
            ]
        },
    ]
})


// 挂载路由导航守卫
// router.beforeEach((to, from, next) => {
//     // to: 将要访问的路径
//     // from : 从那个路径跳转而来
//     // next：是一个函数，表示放行
//     //    next()    

// })

export default router